package cn.itsource.sys.service.impl;

import cn.itsource.basic.service.impl.BaseServiceImpl;
import cn.itsource.sys.domain.DictionaryType;
import cn.itsource.sys.mapper.DictionaryMapper;
import cn.itsource.sys.mapper.DictionaryTypeMapper;
import cn.itsource.sys.service.IDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DictionaryTypeServiceImpl extends BaseServiceImpl<DictionaryType> implements IDictionaryTypeService {
    @Autowired
    private DictionaryTypeMapper dictionaryTypeMapper;
    @Autowired
    private DictionaryMapper dictionaryMapper;

    /**
     * 删除单个数据
     * @param id
     */
    @Transactional
    @Override
    public void del(Long id) {
        dictionaryMapper.delDictionary(id);
        dictionaryTypeMapper.del(id);
    }

    /**
     * 批量删除
     * @param ids
     */
    @Transactional
    @Override
    public void patchDel(Long[] ids) {
        for (Long id : ids) {
            dictionaryMapper.delDictionary(id);
        }
        dictionaryTypeMapper.patchDel(ids);
    }
}
